package com.wendu.oa.dto;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wendu.oa.common.page.PageParam;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class EmployeeDto extends PageParam {

    private String e_id;
    private String e_name;
    private Integer e_sex;
    private Date e_birth;
    private Integer d_id;

    private Date e_start_birth;//开始日期
    private Date e_end_birth;//结束日期

    public String getE_id() {
        return e_id;
    }

    public void setE_id(String e_id) {
        this.e_id = e_id;
    }

    public String getE_name() {
        return e_name;
    }

    public void setE_name(String e_name) {
        this.e_name = e_name;
    }

    public Integer getE_sex() {
        return e_sex;
    }

    public void setE_sex(Integer e_sex) {
        this.e_sex = e_sex;
    }

    public Date getE_birth() {
        return e_birth;
    }

    public void setE_birth(Date e_birth) {
        this.e_birth = e_birth;
    }

    public Integer getD_id() {
        return d_id;
    }

    public void setD_id(Integer d_id) {
        this.d_id = d_id;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd") //指定接收客户端“查询字符串”参数的日期格式
    public Date getE_start_birth() {
        return e_start_birth;
    }

    public void setE_start_birth(Date e_start_birth) {
        this.e_start_birth = e_start_birth;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd") //指定接收客户端“查询字符串”参数的日期格式
    public Date getE_end_birth() {
        return e_end_birth;
    }

    public void setE_end_birth(Date e_end_birth) {
        this.e_end_birth = e_end_birth;
    }


    @Override
    public String toString() {
        try {
            return new ObjectMapper().writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return "EmployeeDto{" +
                    "e_id='" + e_id + '\'' +
                    ", e_name='" + e_name + '\'' +
                    ", e_sex=" + e_sex +
                    ", e_birth=" + e_birth +
                    ", d_id=" + d_id +
                    ", e_start_birth=" + e_start_birth +
                    ", e_end_birth=" + e_end_birth +
                    '}';
        }

    }
}
